﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PagedList<Entity.Car_Rental.Order>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function showDetail(id) {
            $("#detail" + id).toggle();
        }
    </script>
    <h2>
        订单列表</h2>
    <table width="100%" cellpadding="3" cellspacing="1" id="listTable" class="liebiao_table">
        <tr>
            <th>
            </th>
            <th>
                订单号
            </th>
            <th>
                下单用户
            </th>
            <th>
                订单金额
            </th>
            <th>
                商品金额
            </th>
            <th>
                运费
            </th>
            <th>
                支付方式
            </th>
            <th>
                订单状态
            </th>
            <th>
                下单日期
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%: Html.ActionLink("订单完成", "Success", new { id=item.OrderID }) %>
                |
                <%: Html.ActionLink("查看", "Details", new { id=item.OrderID })%>
                |
                <%: Html.ActionLink("删除订单", "Delete", new { id=item.OrderID })%>
                |<a href="javascript:showDetail('<%=item.OrderID %>')">订单明细</a>
            </td>
            <td>
                <%: item.OrderID %>
            </td>
            <td>
                <%: item.BuyerUserID %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.OrderAmount) %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.ProductSaleAmount) %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.ShippingAmount) %>
            </td>
            <td>
                <%: ((Entity.CommonEnums.PayType)item.PayType).GetDescription()%>
            </td>
            <td>
                <%: ((Entity.CommonEnums.OrderStatus)item.OrderStatus).GetDescription()%>
            </td>
            <td>
                <%: item.CreateDate %>
            </td>
        </tr>
        <%if (item.OrderItem_Extend != null && item.OrderItem_Extend.Count() > 0)
          { %>
        <tr style="display: none" id='detail<%=item.OrderID %>'>
            <td colspan="9" bgcolor="#eee">
                <table bgcolor="#000" cellpadding="0" cellspacing="0" width="98%" align="right">
                    <tr>
                        <td>
                            商品ID
                        </td>
                        <td>
                            返还城市
                        </td>
                        <td>
                            返还门店
                        </td>
                        <td>
                            租车开始时间
                        </td>
                        <td>
                            租车结束时间
                        </td>
                        <td>
                            订车状态
                        </td>
                    </tr>
                    <% foreach (var rental in item.OrderItem_Extend.ToList())
                       { %>
                    <tr>
                        <td>
                            <%=rental.RentalRecord_Extend.ProductID%>
                        </td>
                        <td>
                            <%=rental.RentalRecord_Extend.ReturnCity%>
                        </td>
                        <td>
                            <%=rental.RentalRecord_Extend.ReturnShop%>
                        </td>
                        <td>
                            <%=rental.RentalRecord_Extend.StartTime%>
                        </td>
                        <td>
                            <%=rental.RentalRecord_Extend.EndTime%>
                        </td>
                        <td>
                            <%=((Entity.CommonEnums.RentalRecordStatus)rental.RentalRecord_Extend.Status).GetDescription()%>
                            <%if (rental.RentalRecord_Extend.Status != (int)Entity.CommonEnums.RentalRecordStatus.Finished)
                              { %>
                            |
                            <%: Html.ActionLink("完成租车", "FinishRental", new { id = rental.RentalRecord_Extend.ID })%>
                            <%} %>
                        </td>
                    </tr>
                    <%}%>
                </table>
            </td>
        </tr>
        <%
          } %>
        <% } %>
        <tr>
            <td colspan="9">
                <%=Html.Pager(Model) %>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
</asp:Content>
